import Vue from 'vue'
import VueRouter from 'vue-router'
import layout from '../views/layout/index.vue'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    name: 'layout',
    meta: { title:'首页' },
    component: layout,
    redirect:'/home',
    children:[
      {
        path:'home',
        name:'home',
        meta: { title:'首页' },
        component: () => import(/* webpackChunkName: "home" */ '../views/home/index.vue')

      },
      {
        path:'super',
        name:'super',
        meta: { title:'首页' },
        component: () => import(/* webpackChunkName: "super" */ '../views/super/index.vue')

      },
    ]
  },
  {
    path:'/pms',
    name:'layout',
    component:layout,
    redirect: '/pms/product',
    meta: { title:'商品' },
    children:[
      { path: "product",
       name: "product",
        meta: { title:'商品列表' },
        component: () => import(/* webpackChunkName: "product" */ '../views/pms/product/index.vue') 
      },
      { path: "productadd", 
      name: "productadd",
       meta: { title:'添加商品' },
       component: () => import(/* webpackChunkName: "productadd" */ '../views/pms/product/add.vue') 
      },
       { path: "productupdate/:id",
        name: "productupdate", 
        component: () => import(/* webpackChunkName: "productupdate" */ '../views/pms/product/update.vue') 
      },
      { path: "productCate", 
      name: "productCate", 
       meta: { title:'商品分类' },
      component: () => import(/* webpackChunkName: "productCate" */ '../views/pms/productCate/index.vue') 
      },
      { path: "productCateupdate", 
      name: "productCateupdate", 
      //  meta: { title:'商品分类' },
      component: () => import(/* webpackChunkName: "productCateupdate" */ '../views/pms/productCate/update.vue') 
      },
      {path: "productAttr", 
      name: "productAttr", 
       meta: { title:'商品类型' },
      component: () => import(/* webpackChunkName: "productAttr" */ '../views/pms/productAttr/index.vue')
      },
      {path: "productAttrAdd", 
      name: "productAttrAdd", 
      component: () => import(/* webpackChunkName: "productAttrAdd" */ '../views/pms/productAttr/add.vue')
      },
      {path: "productAttrupdate/:id/:name", 
      name: "productAttrupdate", 
      component: () => import(/* webpackChunkName: "productAttrupdate" */ '../views/pms/productAttr/update.vue')
      },
      {path: "brand",
       name: "brand",
        meta: { title:'商品品牌' },
        component: () => import(/* webpackChunkName: "brand" */ '../views/pms/brand/index.vue')
      },
      { path: "productCateAdd",
       name: "productCateAdd", 
       component: () => import(/* webpackChunkName: "productCateAdd" */ '../views/pms/productCate/add.vue')
       },
      { path: "productCateupdate/:id",
       name: "productCateupdate", 
       component: () => import(/* webpackChunkName: "productCateupdate" */ '../views/pms/productCate/update.vue')
       },
    ]
  },
  {
    path: '/login',
    name: 'login',
    component: () => import(/* webpackChunkName: "login" */ '../views/login/index.vue')
  },
    {
    path: '*',
    component: () => import(/* webpackChunkName: "page404" */ '../views/page404/index.vue')
  },
]
const router = new VueRouter({
  routes
})

export default router
